import request from '@/router/request'
import { getToken } from '@/utils/token'
// 获取频道列表
export const allChannelListAPI = () => {
  return request({
    url: '/v1_0/channels',
    method: 'GET'
  })
}
// 用户登录
export const loginAPI = ({ mobile, code }) => {
  return request({
    url: '/v1_0/authorizations',
    method: 'POST',
    data: {
      mobile,
      code
    }
  })
}
// 获取用户频道
export const getUserChanneAPI = () => {
  return request({
    url: '/v1_0/user/channels',
    headers: {
      Authorization: `Bearer ${getToken()}`
    }
  })
}
// 获取频道所对应列表
export const channelArticleListAPI = (channel_id) => {
  return request({
    url: '/v1_0/articles',
    headers: {
      Authorization: `Bearer ${getToken()}`
    },
    params: {
      channel_id,
      timestamp: new Date()
    }
  })
}
